<template>
  <div class="mingpian_card">
    <div class="mingpian_card_top">
      <div class="mingpian_card_top_left">
        <el-image class="mingpian_card_top_left_avatar" :src="props.data.avatar">
          <template #error>
            <el-image class="mingpian_card_top_left_avatar"
              src="//img-scrm-dev.keyid.cn/keyid-scrm-server/avatar/cust_default.png"></el-image>
          </template>
        </el-image>
      </div>
      <div class="mingpian_card_top_right">
        <div class="mingpian_card_top_right_name">{{JSON.parse(props.data?.msgdata).userid}}</div>
        <div v-if="JSON.parse(props.data?.msgdata).corpname != '微信'" class="mingpian_card_top_right_bottom">
          <img class="mingpian_card_top_right_bottom_icon" src="@/assets/chatDetails/wx_corp.png" alt="">
          <div class="mingpian_card_top_right__bottom_corpname">{{JSON.parse(props.data?.msgdata).corpname}}</div>
        </div>
      </div>
    </div>
    <div v-if="JSON.parse(props.data?.msgdata).corpname != '微信'" class="mingpian_card_bottom">企业微信名片</div>
    <div v-else class="mingpian_card_bottom">个人名片</div>

  </div>
</template>

<script setup lang="ts">
const props = defineProps({
  data: {
    type: Object,
    default: () => ({})
  }
})
</script>

<style scoped lang="scss">
.mingpian_card {
  width: 200px;
  line-height: 1;

  .mingpian_card_top {
    display: flex;

    .mingpian_card_top_left {

      .mingpian_card_top_left_avatar {
        width: 40px;
        height: 40px;
        border-radius: 4px;
        margin-right: 10px;
      }

    }

    .mingpian_card_top_right {
      display: flex;
      flex-direction: column;
      justify-content: center;

      .mingpian_card_top_right_name {
        padding-top: 4px;
        font-size: 14px;
        color: #000;
        margin-bottom: 5px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
        word-break: break-all;
      }

      .mingpian_card_top_right_bottom {
        display: flex;
        align-items: center;
        font-size: 12px;
        color: #909399;


        .mingpian_card_top_right_bottom_icon {
          width: 12px;
          height: 12px;
          margin-right: 4px;
        }

        .mingpian_card_top_right__bottom_corpname {
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 1;
          word-break: break-all;
        }
      }
    }

  }

  .mingpian_card_bottom {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #ededed;
    font-size: 10px;
    color: #909399;
  }
}
</style>